#ifndef SYSTEM_GAMEOBJECT_H
#define SYSTEM_GAMEOBJECT_H

#include "Common/Common.h"
#include "DesignPatterns/Singleton.h"
#include <Box2D/Box2D.h>
#include <list>
#include <ECS/ECS.h>
#include "Components/Body.h"
#include "Components/SceneNode.h"
#include "Components/AI.h"
#include <lodestar/aastar.h>

class Box2DVehicle;

class GameObject : public CCObject, public ECS::Assembly
{
	mtMETA_DEC;
public:
    GameObject();
    virtual ~GameObject();

    bool init();

    virtual void update(float dt);

    void setPosition(const Vector& position);

    Vector getPosition() const;

    /// Call all Component::start() methods and brings object to the world.
    void start();

	Signal<void(float)> eventUpdate;
	Signal<void(const Vector&)> eventSetPosition;
};

class World : public Singleton<World>
{
public:
    World();
    virtual ~World();

    bool init();

    b2World* getWorld() const { return mWorld; }

    const std::list < GameObject* >* getObjects() const {return &mObjects;}

    GameObject* createObject();

    MapZone* getMap() const {return _map;}
protected:
    b2World* mWorld;
    MapZone* _map;
private:
    std::list < GameObject* > mObjects;
};
#endif